from PIL import Image
import sys
[a,b]=sys.argv[1:3]
b,c= b=='l' and ('L',(0,)) or ('RGBA',(0,0,0,0))
Image.new(b,Image.open(a).size,c).save(a[-4:]=='.png' and a or a[:-4]+'.png')